
<?php
    include_once("Configs/database.php");
    include_once("CanBo.php");
    class CanBoDaoTao extends CanBo{
        private $nghiepvu;
        public function setNghiepvu($nghiepvu){
            $this->nghiepvu = $nghiepvu;
        }
        public function getNghiepVu(){
            return $this->nghiepvu;
        }
        public function themCanBoDaoTao(){
            $this->setQuery("insert into CanBoDaoTao(maso,nghiepvu) values('".$this->getMaSo()."','".$this->getNghiepVu()."')");
            return $this->executeQuery();
        }
        public function suaCanBoDaoTao(){
            $this->setQuery("update CanBoDaoTao set nghiepvu='".$this->getNghiepVu()."' where maso='".$this->getMaSo()."'");
			 //echo $this->getQuery();
            return $this->executeQuery();
        }
        public function xoaCanBoDaoTao(){
            $this->setQuery("delete CanBoDaoTao where maso='".$this->getMaSo()."'");
            return $this->executeQuery();
        }
        public function thongTinCanBoDaoTao(){
            $query = "select a.maso, concat(holot,' ',ten) as hoten,date_format(ngaysinh,'%d-%m-%Y') as ngaysinh,
						(case phai when 0 then N'Nữ' when 1 then 'Nam' end) as phai, diachi, email, sodt,
						(case hocvi when 'CN' then N'Cử nhân'
									when 'KS' then N'Kĩ sư'
									when 'ThS' then N'Thạc sĩ'
									when 'TS' then N'Tiến sĩ'
									when 'PGS' then N'Phó giáo sư'
									when 'GS' then N'Giáo sư' end) as hocvi,
						nghiepvu from CanBoDaoTao a, CanBo b";
            $query .= " where  a.maso='".$this->getMaSo()."' and a.maso = b.maso";
            $this->setQuery($query);
            return $this->fetchAll();
        }
    }
?>